import {Loading,LoadingController, ToastController, Toast} from 'ionic-angular'
export abstract class BaseUI {
    constructor (){}

    /**
     *通用展示loading的组件
     *
     * @protected 
     * @param {LoadingController} loadingCtrl
     * @param {string} message
     * @returns {Loading}
     * @memberof BaseUI
     */
    protected showLoading(loadingCtrl:LoadingController,message: string):Loading{
        let loader = loadingCtrl.create({
            content: message,
            dismissOnPageChange: true //页面变化自动关闭loading
        });
        loader.present()
        return loader;
    }

     /**
     *通用展示toast的组件
     *
     * @protected 
     * @param {LoadingController} loadingCtrl
     * @param {string} message
     * @returns {Loading}
     * @memberof BaseUI
     */

    protected showToast(toastCtrl: ToastController,message:string):Toast{
        let toast = toastCtrl.create({
            message: message,
            duration: 3000, //默认展示时长
            position: 'bottom'
        });
        toast.present();
        return toast
    }

}